In [4]:
from pandas import DataFrame
import itertools
import numpy as np
from pymatgen.util.plotting_utils import get_publication_quality_plot
%matplotlib inline

In [5]:
d = np.array(list(itertools.product(range(1, 5), range(1, 5))))

In [6]:
data = DataFrame({"X": d[:, 0], "Y": d[:, 1]})
data["Average"] = data.mean(axis=1)

In [7]:
plt = get_publication_quality_plot(12, 8)
print plt.hist(data["Average"], color='k', bins=np.arange(0.75, 4.5, 0.5), width=0.05, normed=True)
plt.xticks(np.arange(0.75, 4.5, 0.5), np.arange(0.75, 4.5, 0.5)  + 0.25)
plt.xlabel("Sample Mean")
plt.ylabel("Probability")


(array([ 0.125,  0.25 ,  0.375,  0.5  ,  0.375,  0.25 ,  0.125]), array([ 0.75,  1.25,  1.75,  2.25,  2.75,  3.25,  3.75,  4.25]), <a list of 7 Patch objects>)
Out[7]:
<matplotlib.text.Text at 0x10c636790>

Estimation


In [8]:
data = [105, 97, 245, 163, 207, 134, 218, 199, 160, 196]

In [15]:
avg = np.average(data)
stddev = 34 / np.sqrt(10)
a = 2.58
interval = (avg - stddev * a, avg + stddev * a)
print interval


(144.66050036500297, 200.13949963499704)

In [ ]: